<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/iCheck/custom.css}" rel="stylesheet"/>
<link href="/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css"
      th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-role-add" th:object="${attend}">
        <input hidden="hidden" name="id" th:value="*{id}">
        <div class="form-group">
            <label class="col-sm-3 control-label ">员工姓名</label>
            <div class="col-sm-8 form-control-static" th:text="*{user.name}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">日期</label>
            <div class="col-sm-8 form-control-static"  th:text="*{#dates.format(currDate,'yyyy-MM-dd')}" >
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">周几</label>
            <div class="col-sm-8 form-control-static" th:text="*{week}" >
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">A.M 上班签到时间</label>
            <div class="col-sm-4">
                <input class="form-control" readonly="readonly"
                       th:value="*{#dates.format(attendMorStart,'HH:mm:ss')} == null ? 未签:*{#dates.format(attendMorStart,'HH:mm:ss')}"
                       type="text"
                       />
            </div>
            <div class="col-sm-4">
                <input class="form-control times" readonly="readonly"
                       type="text" placeholder="修改"
                       name="attendMorStart" id="attendMorStart"/>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label ">A.M 下班签到时间：</label>
            <div class="col-sm-4">
                <input class="form-control" readonly="readonly"
                       th:value="*{#dates.format(attendMorLeave,'HH:mm:ss')} == null ?未签:*{#dates.format(attendMorStart,'HH:mm:ss')}"  placeholder="HH:mm:ss" type="text"
                       />
            </div>
            <div class="col-sm-4">
                <input class="form-control times" readonly="readonly"
                       placeholder="修改" type="text"
                       name="attendMorLeave" id="attendMorLeave"/>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label ">P.M 上班签到时间：</label>
            <div class="col-sm-4">
                <input class="form-control" readonly="readonly"
                       th:value="*{#dates.format(attendNoonStart,'HH:mm:ss')}==null ? 未签:*{#dates.format(attendNoonStart,'HH:mm:ss')}"
                       type="text"
                       />
            </div>
            <div class="col-sm-4">
                <input class="form-control times"
                       readonly="readonly"
                        placeholder="修改" type="text"
                       name="attendNoonStart" id="attendNoonStart"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">P.M 下班签到时间：</label>
            <div class="col-sm-4">
                <input class="form-control" readonly="readonly"
                       th:value="*{#dates.format(attendNoonLeave,'HH:mm:ss')}==null ?未签:*{#dates.format(attendNoonLeave,'HH:mm:ss')}" placeholder="HH:mm:ss" type="text"
                     />
            </div>

            <div class="col-sm-4">
                <input class="form-control times" readonly="readonly"
                        placeholder="修改" type="text"
                       name="attendNoonLeave" id="attendNoonLeave"/>
            </div>
        </div>


        <div class="form-group">
            <div class="form-control-static col-sm-offset-9">
                <button type="submit" class="btn btn-primary">提交</button>
                <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
            </div>
        </div>
    </form>
</div>
<div th:include="include::footer"></div>
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
<script th:src="@{/ajax/libs/select/select2.js}"></script>
<script type="text/javascript">

    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //时间选择器
        laydate.render({
            elem: '.times'
            , type: 'datetime'
        });
    })


    $("#form-role-add").validate({
        rules: {
            title: {required: true}
            , startTime: {required: true}
            , meetRoomId: {required: true}
            ,descr:{
                maxlength:200,
            }
        },
        submitHandler: function () {
            addSave();
        }
    });


    function addSave() {
        $.ajax({
            cache: true,
            type: "POST",
            url: "/attend/editSave",
            data: $("#form-role-add").serializeArray(),
            async: false,
            traditional: true,
            error: function (request) {
                alert(JSON.stringify(request));
                $.modal.alertError("系统错误");
            },
            success: function (data) {
                $.operate.saveSuccess(data);
            }
        });
    }
</script>
</body>
</html>
